/**
  ******************************************************************************
  * @file    xxx.c 
  * @author  SD Electronics xxx
  * @version V1.0
  * @date    xx-xx-xx
  * @brief   xxxxxxxxxxxxxxxxxx.
  ******************************************************************************
  */
/* Define to prevent recursive inclusion -------------------------------------*/


#ifndef _SD_APP_DEV_H
#define _SD_APP_DEV_H


/* Includes ------------------------------------------------------------------*/



/** 
  * 
  */
typedef enum
{
	EN_DEV_CTL_RET_CODE_NULL        = -2, /* */        
    EN_DEV_CTL_RET_CODE_FAILED 	    = -1, /*  */        
	EN_DEV_CTL_RET_CODE_SUCCESSED   = 0,  /* */       
}EN_YH_DEV_RET_CODE;   


/** @defgroup 重定义设备操作函数
  * @{
  */
typedef long (*PFNDevOpenProc)(void *pvHandle, unsigned long ulOption);
typedef long (*PFNDevReadProc)(void *pvHandle, unsigned long ulOpertion, unsigned char *pucDataBuf, int* ulDataSize);
typedef long (*PFNDevWriteProc)(void *pvHandle, unsigned long ulOpertion, unsigned char *pucDataBuf, unsigned long ulDataLen);
typedef long (*PFNDevControlProc)(void *pvHandle,unsigned long ulOpertion, unsigned long ulControlCmd, void *pvd);
typedef long (*PFNDevCloseProc)(void *pvHandle);
/**
  * @}
  */

/** 
  * @
  */
typedef struct
{
    PFNDevOpenProc      pfnDevOpen;     
    PFNDevReadProc      pfnDevRead;      
    PFNDevWriteProc     pfnDevWrite;     
    PFNDevControlProc   pfnDevControl;   
    PFNDevCloseProc     pfnDevClose;     
}ST_CTR_FUN,*PST_CTR_FUN; 


/** 
  * @
  */
typedef struct
{
    unsigned char   ucDevID;	/* 设备ID */       
    void            *pvData;    /* 设备控制数据*/  
    PST_CTR_FUN     pstCtrFun;  /* 设备控制函数 */   
}ST_DEV_MANAGE, *PST_DEV_MANAGE; 


/** 
  * @
  */
typedef struct
{
    unsigned short usDevCount;   /* 设备数量 */   
    PST_DEV_MANAGE pstDevManage; /* 设备管理 */  
}ST_DEV_MANAGE_INFO, *PST_DEV_MANAGE_INFO;



/** 
  *@设备枚举
  */
typedef enum
{
	EN_DEV_CPU = 0,				/* CPU */
	EN_DEV_TIMER,               /* Timer */
	EN_DEV_FLASH_ONCHIP,		/* on chip flash */
	EN_DEV_RUN_LED,             /* Run LED*/
	EN_DEV_USB,                 /* USB*/
    EN_DEV_IIC,                 /* 5-IIC*/
	EN_DEV_CAN,                 /* CAN*/
	EN_DEV_USART,				/* USART*/
	EN_DEV_BT,					/* BT */
    EN_DEV_BLE,                 /* BLE*/
    EN_DEV_MESH,                /* 10-Mesh*/
    EN_DEV_SH3001,              /* 深迪SH3001*/
    EN_DEV_NTC,                 /* NTC */
    EN_DEV_KEY,                 /* KEY */
    EN_DEV_HALL,                /* 霍尔 */
    EN_DEV_TM1621C,             /* TM1621C屏驱动 */
    EN_DEV_BEEP,                /* 蜂鸣器 */
    EN_DEV_MOTOR,               /* 电机 */
    EN_DEV_ADC,                 /* ADC */
	EN_DEV_MAX,					
}EN_DEV_ID;





/** @defgroup FunctionDeclaration
  * @{
  */ 
long SDDevManageInit(void);
void SDDevInit(void *pvParamer);
PST_DEV_MANAGE SDDevManageWrite (unsigned char ucDevID, unsigned long ulOpertion, void* pData, unsigned long pDataLen);
PST_DEV_MANAGE SDDevManageRead(unsigned char ucDevID, unsigned long ulOpertion, unsigned char *pucDataBuf, int* ulDataSize);
PST_DEV_MANAGE SDDevManageCtrl(unsigned char ucDevID, unsigned long ulOpertion, unsigned long ulControlCmd, void *pvd);
/**
  * @}
  */ 

#endif

/******************* (C) COPYRIGHT 2011 ShenZhenShiding electronics **************************/
